<!-- <template>
  <div class="box">
    <span>店铺设置</span>
    <el-button type="success" @click="modify">修改</el-button>
    <ul>
      <li>店铺名称:{{ company.name }}</li>
      <li>店铺地址:{{ company.address }}</li>
      <li v-if="company.logo">
        店铺标志:<img :src="this.company.logo[0].url || this.logo[0].url" alt="" />
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      company: {},// 商家信息
      logo: [], // logo图片信息
    };
  },
  methods: {
    modify() {
      this.$router.push({
        name: "ModifyInfor",
        params: { company: this.company },
      });
    },
  },
  mounted() {
    // 从本地存储获取商家信息
    this.company = JSON.parse(localStorage.getItem("company"));
    // 照片信息单独获取
    let logo = JSON.stringify(this.company.logo);
    if (typeof logo == "string") {
      this.logo = JSON.parse(this.company.logo);
    } else {
      this.logo = logo;
    }
  },
};
</script>

<style lang="less" scoped>
.box {
  padding: 0 9.6% 0;
  min-width: 909px;
  width: 100%;
  z-index: -1;
  background-color: #f6f8f9;
}

// 店铺设置
.box span {
  font-weight: 700;
  display: block;
  font-size: 18px;
}

.box button {
  text-align: right;
  margin: 42px 0 42px 600px;
}

.box ul li {
  margin-bottom: 20px;
}
.box ul li img{
  width: 400px;
  margin:30px 95px;
}
</style> -->






<template>
  <div class="ordering" v-loading.fullscreen.lock="loading">
    <div class="heading">店铺设置</div>
    <div class="set-up-view">
      <div class="button-view-set">
        <el-button type="success" size="medium" @click="setCl()">修改</el-button>
      </div>
      <!-- 内容 -->
      <div v-for="(item, index) in setdata" :key="index">
        <div class="set-name">
          <div>店铺名称:</div>
          <div>{{ item.name }}</div>
        </div>
        <div class="set-name">
          <div>店铺地址:</div>
          <div>{{ item.address }}</div>
        </div>
        <div class="set-up-image">
          <div>店铺logo:</div>
          <div class="set-image">
            <div v-for="(iteming, index) in item.logo" :key="index"><img :src="iteming.url" /></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
  
<script>
export default {
  data() {
    return {
      loading: true,
      setdata: []
    }
  },
  methods: {
    // 跳转修改
    setCl() {
      this.$router.push({ name: 'modify-infor', params: { company: this.setdata[0] } });
    },
    // 获取商家信息
    async obtainshop() {
      try {
        let res = await new this.request(this.URL.m().obtainshop).GET();
        this.setdata = [JSON.parse(res.data.data.data)]
        console.log(this.setdata,JSON.parse(res.data.data.data),'data');
        this.loading = false
      } catch (e) {
        this.Message_Box.MessageError("亲!获取失败，请重新尝试");
      }
    }

  },
  created() {
    this.obtainshop()
  }
}
</script>
  
<style scoped="scoped">
.heading {
  font-size: 20px;
  font-weight: bold;
}

.set-up-view {
  max-width: 900px;
  margin-top: 30px;
}

.button-view-set {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 30px;
}

.set-name {
  display: flex;
  align-items: center;
  margin-bottom: 30px;
}

.set-name div:nth-child(1) {
  width: 100px;
}

.set-name div:nth-child(2) {
  flex: 1;
}

.set-up-image {
  margin-bottom: 30px;
}

.set-image img {
  width: 50%;
  height: 100%;
  border-radius: 5px;
}

.set-image {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
}
</style>
  